API: Series[bool][key] = np.nan -> cast to object#38709
API: Series[bool][key] = np.nan -> cast to object#38709jreback merged 23 commits intopandas-dev:masterfrom
Conversation
|
yikes, the existing behavior is even worse than i thought: This fixes that; ill add a test. gentle ping @jreback this is probably the toughest of the outstanding setitem-related PRs |
jreback
left a comment
There was a problem hiding this comment.
I am ok with this change as long as we have a sub-section in api breaking.
pandas/core/array_algos/putmask.py
Outdated
|
|
||
| # change the dtype if needed | ||
| dtype, _ = maybe_promote(new.dtype) | ||
| if values.dtype == bool and new.dtype.kind == "f": |
There was a problem hiding this comment.
hmm, shouldn't maybe_promote handle this? (`maybe_promote(new.dtype, values.dtype) ?
There was a problem hiding this comment.
wouldnt find_common_type make more sense?
There was a problem hiding this comment.
yah this is nicer, updated
added + green |
|
thanks, very nice |
|
way cool. between this and #39163 ill be un-blocked on unifying a bunch of casting behavior i think |
|
The appears to be a performance regression here https://pandas.pydata.org/speed/pandas/#frame_methods.MaskBool.time_frame_mask_bools There has been some improvement since. profile Detailscommit before DetailsI guess this is expected? |
Can't comment on the size of the perf hit, but the existence is unsurprising since we're casting to object |
black pandasgit diff upstream/master -u -- "*.py" | flake8 --diffsits on top of #38688